{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 1.  2.  3.  4.  5.  6.  7.  8.  9. 10. 11. 12. 13. 14. 15.]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD4CAYAAAAAczaOAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAh80lEQVR4nO3de7yVY/7/8denow5CB1S7phCjQrElku84pEJqEnbIacihoYghZsb4jYyhQpgoh5zanVUoCTlXVEpnMpVKyClpTKr9+f1x343dbrf32nuvte6113o/H4/1aO1r3Yf3qvZn3eu6r/u6zd0REZHMUCHqACIikjwq+iIiGURFX0Qkg6joi4hkEBV9EZEMUinqAMWpW7euN2nSJOoYIiLlyrx5875x93oF21O+6Ddp0oS5c+dGHUNEpFwxszWFtat7R0Qkg6joi4hkEBV9EZEMoqIvIpJBUv5ErohISjIr+vUUnddMR/oiIhlERV9EJIOo6IuIpJht22DevMRsW336IiIpxB2uvBI2bYIXXoj/9lX0RURSyC23wIoV8Npridm+ir6ISIoYPBheegneeQdq1EjMPlT0RURSwDPPwNCh8O67UKdO4vajoi8iErGpU+FPf4KZM6FRo8Tuq9jRO2bWyMxmmtkyM1tiZn3D9qPMbJaZLTKzF82sVr51BpjZSjNbYWYd87UfEy6/0syGmhV3dYOISHqbNQsuvRQmTYLDD0/8/mIZsrkd6O/uhwNtgT5m1hx4HLjV3Y8AXgBuBghfywFaAJ2Af5lZxXBbw4DeQLPw0SmO70VEpFxZuhR+/3t4+mlo2zY5+yy26Lv7BnefHz7fDCwDGgKHAW+Hi80AzgmfdwVGu/tWd18FrATamFl9oJa7z3J3B54BusXzzYiIlBdr10KnTjBoEHTunLz9lujiLDNrArQG5gCLgbPDl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KIir6ISAZR0RcRySAq+iIiGeT/A4MkAoKjfjIOAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# layer1：激励函数+乘加运算\n",
    "import tensorflow as tf\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "date = np.linspace(1,15,15)\n",
    "endPrice = np.array([2511.90,2538.26,2510.68,2591.66,2732.98,2701.69,2701.29,2678.67,2726.50,2681.50,2739.17,2715.07,2823.58,2864.90,2919.08]\n",
    ")\n",
    "beginPrice = np.array([2438.71,2500.88,2534.95,2512.52,2594.04,2743.26,2697.47,2695.24,2678.23,2722.13,2674.93,2744.13,2717.46,2832.73,2877.40])\n",
    "print(date)\n",
    "plt.figure()\n",
    "for i in range(0,15):\n",
    "    # 1 柱状图\n",
    "    dateOne = np.zeros([2])\n",
    "    dateOne[0] = i;\n",
    "    dateOne[1] = i;\n",
    "    priceOne = np.zeros([2])\n",
    "    priceOne[0] = beginPrice[i]\n",
    "    priceOne[1] = endPrice[i]\n",
    "    if endPrice[i]>beginPrice[i]:\n",
    "        plt.plot(dateOne,priceOne,'r',lw=8)\n",
    "    else:\n",
    "        plt.plot(dateOne,priceOne,'g',lw=8)\n",
    "#plt.show()\n",
    "# A(15x1)*w1(1x10)+b1(1*10) = B(15x10)\n",
    "# B(15x10)*w2(10x1)+b2(15x1) = C(15x1)\n",
    "# 1 A B C \n",
    "dateNormal = np.zeros([15,1])\n",
    "priceNormal = np.zeros([15,1])\n",
    "for i in range(0,15):\n",
    "    dateNormal[i,0] = i/14.0;\n",
    "    priceNormal[i,0] = endPrice[i]/3000.0;\n",
    "    \n",
    "## placeholder()函数用于定义过程，在执行的时候再赋具体的值。\n",
    "x = tf.placeholder(tf.float32,[None,1])\n",
    "y = tf.placeholder(tf.float32,[None,1])\n",
    "# B\n",
    "w1 = tf.Variable(tf.random_uniform([1,10],0,1))\n",
    "b1 = tf.Variable(tf.zeros([1,10]))\n",
    "wb1 = tf.matmul(x,w1)+b1    ## x * w1 [None,10] +b1  每一行都加b1\n",
    "layer1 = tf.nn.relu(wb1) ## 激励函数,转化一下值\n",
    "# C\n",
    "w2 = tf.Variable(tf.random_uniform([10,1],0,1))\n",
    "b2 = tf.Variable(tf.zeros([15,1]))\n",
    "wb2 = tf.matmul(layer1,w2)+b2\n",
    "layer2 = tf.nn.relu(wb2)\n",
    "loss = tf.reduce_mean(tf.square(y-layer2))#y 真实 layer2 计算，差值开放求平均-> 方差\n",
    "train_step = tf.train.GradientDescentOptimizer(0.1).minimize(loss)  ##梯度下降\n",
    "with tf.Session() as sess:\n",
    "    sess.run(tf.global_variables_initializer())\n",
    "    for i in range(0,10000):\n",
    "        sess.run(train_step,feed_dict={x:dateNormal,y:priceNormal})\n",
    "    # w1w2 b1b2  A + wb -->layer2\n",
    "    pred = sess.run(layer2,feed_dict={x:dateNormal})\n",
    "    predPrice = np.zeros([15,1])\n",
    "    for i in range(0,15):\n",
    "        predPrice[i,0]=(pred*3000)[i,0]\n",
    "    plt.plot(date,predPrice,'b',lw=1)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
